package com.xingongchang.baolebei.protocol;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.external.activeandroid.Model;

public class CLIENT extends Model {
	public String token;

	public String client_type;

	public String version;

	public String code;

	public static CLIENT fromJson(JSONObject jsonObject) throws JSONException {
		if (null == jsonObject) {
			return null;
		}

		CLIENT localItem = new CLIENT();

		JSONArray subItemArray;

		localItem.token = jsonObject.optString("token");

		localItem.client_type = jsonObject.optString("client_type");

		localItem.version = jsonObject.optString("version");

		localItem.code = jsonObject.optString("code");

		return localItem;
	}

	public JSONObject toJson() throws JSONException {
		JSONObject localItemObject = new JSONObject();
		JSONArray itemJSONArray = new JSONArray();

		localItemObject.put("token", token);
		localItemObject.put("client_type", client_type);
		localItemObject.put("version", version);
		localItemObject.put("code", code);
		return localItemObject;
	}
}
